import 'dart:math';

import 'package:business_getx/pages/controller/other.dart';
import 'package:flutter/material.dart';
import 'package:lib_core/lib_core.dart';
import 'package:lib_ui/lib_ui.dart';
import 'package:lib_ui/widget/main_button.dart';

class ControllerTest4 extends StatefulWidget {

  const ControllerTest4({super.key});

  @override
  State<ControllerTest4> createState() => _ControllerTest4State();
}

class _ControllerTest4State extends State<ControllerTest4> {
  late final logic = Get.put(Other());

  @override
  void initState() {
    super.initState();
    debugPrint('TextController - ControllerTest4 initState');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: TransparentAppBar(title: '注入依赖4'),
      body: Container(
        height: Get.height,
        width: Get.width,
        alignment: Alignment.center,
        child: Obx(() => MainButton(
              text: '${logic.text}',
              onClick: () {
                logic.text.value = '${logic.text.value}(${Random().nextInt(50).toString()})';
              },
            )),
      ),
    );
  }
}
